<template>
  <div class="about">
    <h1>This is an about page</h1>
    <!-- {{details}} -->
    <h1>{{details.title}}</h1>
    <!-- 显示具有html结构的内容 -->
    <h1 v-html='details.content'></h1>
    <h1 v-if='details.category'>{{details.category.name}}</h1>
  </div>
</template>
<script>
// 导入axios
import axios from '../http/axios'
export default {
  data(){
    return {
      details:[]
    }
  },
  created(){
    // console.log(this.$route.params.id)
    this.findDetail(this.$route.query.id)
  },
  methods:{
    findDetail(id){
      var obj = {
        id:id
      }
      axios({
        url:'http://121.199.29.84:8001/article/findById',
        method:'get',
        params:obj
      }).then((res)=>{
        this.details = res.data.data
      })
    }
  }
}
</script>
